#include "ZigbusOrderDirection.h"

ZigbusOrderDirection::ZigbusOrderDirection()
    : ZigbusItem(-1, ORDER_DIRECTION_SIZE)
{
}

ZigbusOrderDirection::ZigbusOrderDirection(int value)
    : ZigbusItem(value, ORDER_DIRECTION_SIZE)
{
}

ZigbusOrderDirection::ZigbusOrderDirection(const QString &str)
    : ZigbusItem(-1, ORDER_DIRECTION_SIZE)
{
    if(str == "query") setValue(DIRECTION_QUERY);
    else if(str == "response") setValue(DIRECTION_RESPONSE);
}

ZigbusOrderDirection::ZigbusOrderDirection(const ZigbusOrderDirection &other)
    : ZigbusItem(other)
{
}

QString ZigbusOrderDirection::text() const
{
    switch(getValue()) {
    case DIRECTION_QUERY: return "query";
    case DIRECTION_RESPONSE: return "response";
    default: return "unknown";
    }
}
